<?php

namespace app\meizhuangapi\controller;

use app\meizhuangapi\model\store\Shop as ShopModel;
use app\api\controller\Shop as ShopCon;

/**
 * 门店列表
 * Class Shop
 * @package app\api\controller
 */
class Shop extends ShopCon
{
    /**
     * 门店列表
     */
    public function lists(){
        $longitude=input('post.longitude');//经度
        $latitude=input('post.latitude');//纬度
        $ckAddressId=input('post.shop_id');//所选的店铺自提点
        $name=input('post.shop_name');//搜索的店铺名称
        $model = new ShopModel;
        $list = $model->getList(true, $longitude, $latitude,100,$name);
        //根据店铺id是否已选中
        if($ckAddressId){
            foreach($list as $k=>$v){
                if($v['shop_id']==$ckAddressId){
                    $list[$k]['checked']='true';
                }else{
                    $list[$k]['checked']='false';
                }
            }
        }else{
            foreach($list as $k=>$v){
                 $list[$k]['checked']='false';
            }
        }
        return $this->renderSuccess(compact('list'));
    }
}